package com.zbkj.crmeb.system.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.common.PageParamRequest;
import com.github.pagehelper.PageInfo;
import com.zbkj.crmeb.system.model.SystemAdmin;
import com.zbkj.crmeb.system.request.ForgetPwdRequest;
import com.zbkj.crmeb.system.request.SystemAdminAddRequest;
import com.zbkj.crmeb.system.request.SystemAdminRequest;
import com.zbkj.crmeb.system.response.SystemAdminResponse;

import java.util.List;

/**
* @author Mr.Zhang
* @Description SystemAdminService 接口
* @since 2020-04-13
*/
public interface SystemAdminService extends IService<SystemAdmin> {
	PageInfo<SystemAdminResponse> getList(SystemAdminRequest request, PageParamRequest pageParamRequest);

    SystemAdminResponse getInfo(SystemAdminRequest request) throws Exception;

    SystemAdminResponse login(SystemAdminRequest request, String ip, String identification) throws Exception;

    /**
     * 根据Token获取对应用户信息
     *
     * @param token
     * @return
     */
    SystemAdminResponse getInfoByToken(String token) throws Exception;

    /**
     * 用户登出
     *
     * @param token
     * @return
     * @throws Exception
     */
    Boolean logout(String token) throws Exception;

    /**
     * 新增管理员
     *
     * @param systemAdminAddRequest
     * @return
     */
    SystemAdminResponse saveAdmin(SystemAdminAddRequest systemAdminAddRequest) throws Exception;

    /**
     * 更新管理员
     *
     * @param systemAdminRequest
     * @return
     * @throws Exception
     */
    SystemAdminResponse updateAdmin(SystemAdminRequest systemAdminRequest,String originalPwd) throws Exception;

    Integer getAdminId();

    SystemAdmin getInfo(Integer adminId);

    SystemAdmin getInfo();
    
    /**
     * 获取当前用户默认商户
     * @author daigb
     * @date:  2021-12-22 14:18
     */
    Integer getAdminMerId();
    
    /**
     * 获取当前用户所有商户
     * @author daigb
     * @date:  2021-12-22 14:18
     */
    List<Integer> getAdminMerIds();

    /**
     * 获取服务商所有商户
     * @author lvmd
     * @date:  2022-02-21
     */
    List<Integer> getAdminAgentMerIds();

    /**
     * 获取当前账户服务商id
     *
     * @author lvmd
     * @date:  2022-02-21
     */
    Integer getAdminAgentId();

    /**
     * 验证账号参数
     * @param systemAdminAddRequest
     */
    void validatedSystemAdmin(SystemAdminAddRequest systemAdminAddRequest);

    /**
     * 验证账号参数
     * @param systemAdminRequest
     */
    void validatedSystemAdmin(SystemAdminRequest systemAdminRequest);

    /**
     * 账号绑定
     * @param merchantId 商户账号id
     * @param supplierId 供应商账号id
     * @return java.lang.Boolean
     */
    Boolean accountBinding(Integer merchantId,Integer supplierId);

    /**
     * 账号解除绑定
     * @param id 账号id
     * @return java.lang.Boolean
     */
    Boolean accountUnbinding(Integer id) throws Exception;

    /**
     * 免密登录
     * @param token
     * @param ip
     * @return com.zbkj.crmeb.system.response.SystemAdminResponse
     */
    SystemAdminResponse passwordFreeLogin(String token, String ip) throws Exception;

    /**
     * 功能描述: 修改密码
     * @Param: [request]
     * @Return: java.lang.Boolean
     * @Author: wangzh
     * @Date: 2023/4/21 14:34
     */
    Boolean forgotPwd(ForgetPwdRequest request);

    /**
     * 功能描述: 发送验证码
     * @Param: [phone]
     * @Return: java.lang.Boolean
     * @Author: wangzh
     * @Date: 2023/4/21 15:08
     */
    Boolean sendCode(String phone, Integer template);

    /**
     * 功能描述: 账号注册
     * @Param: [request]
     * @Return: java.lang.Boolean
     * @Author: wangzh
     * @Date: 2023/4/23 14:11
     */
    SystemAdminResponse registerAccount(ForgetPwdRequest request);
}
